﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ODM_Code.Forms
{
    public partial class NewAlternativeForm : Form
    {
        private Code.AlternativeSetupCode asc;
        private string dbfPath;
        private string inputPath;
        private string alternativePath;

        public NewAlternativeForm()
        {
            InitializeComponent();
            asc = new Code.AlternativeSetupCode();

            dbfPath = "C:\\magfire\\" + ConfigSettings.ReadSetting("analysisArea");
            inputPath = dbfPath + "\\input";
        }

        private void butCreate_Click(object sender, EventArgs e)
        {
            if (tbName.Text.Equals(""))
            {
                MessageBox.Show("An alternative name is required.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string newName = tbName.Text;
            newName.Replace(' ', '_');

            string alternativePath = inputPath + "\\" + newName;
            asc.CopyNeededFiles(dbfPath, inputPath, alternativePath);

            this.Close();
        }

        private void butCancel_Click(object sender, EventArgs e)
        {

            this.Close();
        }
    }
}
